package 蓝桥.十三届;

import java.util.Scanner;

/**
 * @author ZhuYi
 * @create 2025/4/9 11:02
 */
public class B山 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int count = 0;
        for (int i = 2022; i <= 2022222022; i++) {
            if (huiwen(i))
                count++;
        }
        System.out.println(count);
        scan.close();
    }
    public static boolean huiwen(int x) {
        String c = String.valueOf(x);
        int n = c.length();
        for (int i = 0; i < n / 2; i++) {
            if (c.charAt(i) > c.charAt(i + 1) || c.charAt(n - i - 1) > c.charAt(n - i - 2))
                return false;
            if (c.charAt(i) != c.charAt(n - i - 1))
                return false;
        }
        return true;
    }
}
